<template>
  <a-table
    :columns="this.columns"
    :data-source="this.dataSource"
    :rowSelection="rowSelection"
     />
</template>

<script>
export default {
  name: 'pCRUDTable',
  props: {
    title: String,
    columns: Array,
    dataSource: Array,
    deleteData: {
      type: Function,
      required: true
    }
  },
  computed: {
    rowSelection () {
      return {
        selectedRowKeys: this.selectedRowKeys,
        onChange: this.onSelectChange
      }
    }
  },
  data () {
    return {
      selectedRowKeys: [],
      selectedRows: []
    }
  },
  methods: {
    onSelectChange (selectedRowKeys, selectedRows) {
      this.selectedRowKeys = selectedRowKeys
      this.selectedRows = selectedRows
      console.log(selectedRows, selectedRowKeys)
    }
  },
  created () {
    // console.log(this.title)
    console.log(this.columns)
    console.log(this.dataSource)
    // this.deleteData()
  }
}
</script>

<style scoped>

</style>
